<?php

// No direct access
defined('_JEXEC') or die('Restricted access'); 
$db = &JFactory::getDBO();
?>
<script>jQuery("img").lazyload();</script>
<div class="componentheader">
	<?php 
	if($this->category->title != '')
		echo $this->category->title;
	elseif(isset($this->category->name))
			echo $this->category->name; 
		else
			echo 'Онлайн каталог эротичного белья';
			
	?>
</div>
<div class="navig">
Всего <span style="color:#01647d;font-weight:bold;"><?php echo $this->count?></span> товаров, страницы:
</div>
<div class="pages">
<?php echo $this->navig_panel?>
</div>
<div class="sorting">
Сортировать по цене: <a href="index.php?option=com_shop&view=tags&id=<?php echo $this->cat_id?>&page=<?php if($this->page_i !== 0) echo 1; else echo 0;?>&order_by=price_a">по возрастанию</a> | <a href="index.php?option=com_shop&view=tags&id=<?php echo $this->cat_id?>&page=<?php if($this->page_i !== 0) echo 1; else echo 0;?>&order_by=price_d">по убыванию</a>
</div>
<table class="category_list" width="100%" cellspacing=0 cellpadding=0>
	
	<?php foreach($this->items as $key=>$item):?>
	
	<?php 
			
	
	
	?>
	<tr>
		<td class="left_cols">
			<div class="image_div">
				<div class="corner_left_top"></div>
				<div class="corner_right_top"></div>
				<div class="corner_right_bottom"></div>
				<div class="corner_left_bottom"></div>
				<a href="index.php?option=com_shop&view=item&id=<?php echo $item->articul;?>"><img src="<?php echo JURI::root( true ).'/components/com_shop/images/small/'.$item->main_img ?>" alt="<?php echo $item->name?>" /></a>
			</div>
			<div class="title_div"><a href="index.php?option=com_shop&view=item&id=<?php echo $item->articul;?>"><?php echo htmlspecialchars($item->name);?></a></div>
			<div class="main_div">
				
				<span style="color:#5c392d;">Цена: </span> <?php echo $item->price; ?>.00 руб.<br/>
				<?php if($item->old_price != 0){ ?><span style="color:#5c392d;">Старая цена: </span><span style="text-decoration:line-through;"><?php echo $item->old_price.'.00 руб.';?></span><br/><?php }?><span style="color:#5c392d;">Модель: </span><?php if($item->from_xml == 1)echo 'E'; if($item->from_xml == 2) echo 'O';
				if($item->articul_wo_char != '0' && $item->articul_wo_char != ''):?><?php echo $item->articul_wo_char;?><br/><?php ?>
				<?Php else: echo $item->articul;?><br/><?php endif;?>
				
			</div>
			<div class="more_info"><a href="index.php?option=com_shop&view=item&id=<?php echo $item->articul;?>">подробнее</a></div>
			
		</td>
		<td valign="top" class="right_cols">
			<?php 
			//	$query = "SELECT * FROM #__shop_fields_values WHERE field_id=1 AND object_id=".$item->id;
			//	$db->setQuery($query);
			//	$types = $db->loadObjectList();
				$types = $this->types[$key];
				if(count($types)>0):		
			?>
			<div class="attributes">Цвет/размер:<br/>
			<table>				
			<?php 
				
				foreach($types as $type){
					echo '<tr><td style="width:125px;" class="values">'.$type->value.'</td>';
					echo '<td valign="top" style="padding-left:5px;">
							<div class="add_to_basket">
								<a href="index.php?option=com_shop&task=addToBasket&id='.$item->articul.'&type='.urlencode($type->value).'">в корзину</a>
							</div>
						 </td>';
					echo '</tr>';
				}
			
			?>
				
			</table>
			</div>
			<?php else:?>
			<div class="attributes">
				К сожалению, позиция отсутствует в текущих каталогах компании.
			</div>
			<?php endif;?>
		</td>
		
	</tr>
	<?php endforeach;?>
</table>

<div class="sorting">
Сортировать по цене: <a href="index.php?option=com_shop&view=tags&id=<?php echo $this->cat_id?>&page=<?php if($this->page_i !== 0) echo 1; else echo 0;?>&order_by=price_a">по возрастанию</a> | <a href="index.php?option=com_shop&view=tags&id=<?php echo $this->cat_id?>&page=<?php if($this->page_i !== 0) echo 1; else echo 0;?>&order_by=price_d">по убыванию</a>
</div>
<div class="navig" >
Всего <span style="color:#01647d;font-weight:bold;"><?php echo $this->count?></span> товаров, страницы:
</div>
<div class="pages">
<?php echo $this->navig_panel?>
</div>
<div class="cat_description">
<?php
if($this->page=='' && $this->sort == '') echo $this->category->descr1;
if($this->page=='2' && $this->sort == '') echo $this->category->descr2;	
if($this->page=='3' && $this->sort == '') echo $this->category->descr3;	

?>
</div>